/**

This file is part of MaCI/GIMnet.

MaCI/GIMnet is free software: you can redistribute it and/or modify it 
under the terms of the GNU Lesser General Public License as published 
by the Free Software Foundation, either version 3 of the License, or 
(at your option) any later version.

MaCI/GIMnet is distributed in the hope that it will be useful, but WITHOUT 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public 
License for more details.

You should have received a copy of the GNU Lesser General Public 
License along with GIMnet. (See COPYING.LESSER) If not, see 
<http://www.gnu.org/licenses/>.

**/
/**
 * \file
 * \brief Simple Active status container class.
 * \author Harri Kukkonen
 */
#ifndef GIMI_ACTIVESTATUS_H
#define GIMI_ACTIVESTATUS_H

namespace gimi {

/**
 * \class ActiveStatus
 * Class to wrap active-status handling. Thread-safe since boolean indicating
 * status is marked volatile.
 */
class ActiveStatus {
  public:
    ActiveStatus(bool startStatus = false);
    ~ActiveStatus();

    inline bool isActive() const { return active; }

    inline void deactivate() { active = false; }
    inline void activate() { active = true; }
    
  private:
    volatile bool active;
};

} // end namespace gimi

#endif // GIMI_ACTIVESTATUS_H
